home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / CIncludes / CMApplication.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-18  |  27.7 KB  |  754 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CMApplication.h
  3.  
  4.      Contains:    Color Matching Interfaces
  5.  
  6.      Version:    Technology:    ColorSync 2.0
  7.                  Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __CMAPPLICATION__
  21. #define __CMAPPLICATION__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __QUICKDRAW__
  30. #include <Quickdraw.h>
  31. #endif
  32. /*    #include <MixedMode.h>                                        */
  33. /*    #include <QuickdrawText.h>                                    */
  34.  
  35. #ifndef __FILES__
  36. #include <Files.h>
  37. #endif
  38. /*    #include <OSUtils.h>                                        */
  39. /*        #include <Memory.h>                                        */
  40.  
  41. #ifndef __PRINTING__
  42. #include <Printing.h>
  43. #endif
  44. /*    #include <Errors.h>                                            */
  45. /*    #include <Dialogs.h>                                        */
  46. /*        #include <Windows.h>                                    */
  47. /*            #include <Events.h>                                    */
  48. /*            #include <Controls.h>                                */
  49. /*                #include <Menus.h>                                */
  50. /*        #include <TextEdit.h>                                    */
  51.  
  52. #ifndef __CMICCPROFILE__
  53. #include <CMICCProfile.h>
  54. #endif
  55.  
  56. #ifdef __cplusplus
  57. extern "C" {
  58. #endif
  59.  
  60. #if PRAGMA_ALIGN_SUPPORTED
  61. #pragma options align=mac68k
  62. #endif
  63.  
  64. #if PRAGMA_IMPORT_SUPPORTED
  65. #pragma import on
  66. #endif
  67.  
  68.  
  69. enum {
  70.     gestaltColorSync20            = 0x0200
  71. };
  72.  
  73. enum {
  74.     kDefaultCMMSignature        = 'appl'
  75. };
  76.  
  77. /* Macintosh 68K trap word */
  78. enum {
  79.     cmTrap                        = 0xABEE
  80. };
  81.  
  82. /* PicComment IDs */
  83. enum {
  84.     cmBeginProfile                = 220,
  85.     cmEndProfile                = 221,
  86.     cmEnableMatching            = 222,
  87.     cmDisableMatching            = 223,
  88.     cmComment                    = 224
  89. };
  90.  
  91. /* PicComment selectors for cmComment */
  92. enum {
  93.     cmBeginProfileSel            = 0,
  94.     cmContinueProfileSel        = 1,
  95.     cmEndProfileSel                = 2
  96. };
  97.  
  98. /* Defines for version 1.0 CMProfileSearchRecord.fieldMask */
  99. enum {
  100.     cmMatchCMMType                = 0x00000001,
  101.     cmMatchApplProfileVersion    = 0x00000002,
  102.     cmMatchDataType                = 0x00000004,
  103.     cmMatchDeviceType            = 0x00000008,
  104.     cmMatchDeviceManufacturer    = 0x00000010,
  105.     cmMatchDeviceModel            = 0x00000020,
  106.     cmMatchDeviceAttributes        = 0x00000040,
  107.     cmMatchFlags                = 0x00000080,
  108.     cmMatchOptions                = 0x00000100,
  109.     cmMatchWhite                = 0x00000200,
  110.     cmMatchBlack                = 0x00000400
  111. };
  112.  
  113. /* Defines for version 2.0 CMSearchRecord.searchMask */
  114. enum {
  115.     cmMatchAnyProfile            = 0x00000000,
  116.     cmMatchProfileCMMType        = 0x00000001,
  117.     cmMatchProfileClass            = 0x00000002,
  118.     cmMatchDataColorSpace        = 0x00000004,
  119.     cmMatchProfileConnectionSpace = 0x00000008,
  120.     cmMatchManufacturer            = 0x00000010,
  121.     cmMatchModel                = 0x00000020,
  122.     cmMatchAttributes            = 0x00000040,
  123.     cmMatchProfileFlags            = 0x00000080
  124. };
  125.  
  126. /* Result codes */
  127. enum {
  128. /* General Errors */
  129.     cmProfileError                = -170,
  130.     cmMethodError                = -171,
  131.     cmMethodNotFound            = -175,                            /* CMM not present */
  132.     cmProfileNotFound            = -176,                            /* Responder error */
  133.     cmProfilesIdentical            = -177,                            /* Profiles the same */
  134.     cmCantConcatenateError        = -178,                            /* Profile can't be concatenated */
  135.     cmCantXYZ                    = -179,                            /* CMM cant handle XYZ space */
  136.     cmCantDeleteProfile            = -180,                            /* Responder error */
  137.     cmUnsupportedDataType        = -181,                            /* Responder error */
  138.     cmNoCurrentProfile            = -182,                            /* Responder error */
  139. /* Profile Access Errors */
  140.     cmElementTagNotFound        = -4200,
  141.     cmIndexRangeErr                = -4201,                        /* Index out of range */
  142.     cmCantDeleteElement            = -4202,
  143.     cmFatalProfileErr            = -4203,
  144.     cmInvalidProfile            = -4204,                        /* A Profile must contain a 'cs1 ' tag to be valid */
  145.     cmInvalidProfileLocation    = -4205,                        /* Operation not supported for this profile location */
  146. /* Profile Search Errors */
  147.     cmInvalidSearch                = -4206,                        /* Bad Search Handle */
  148.     cmSearchError                = -4207,
  149.     cmErrIncompatibleProfile    = -4208,
  150. /* Other ColorSync Errors */
  151.     cmInvalidColorSpace            = -4209,                        /* Profile colorspace does not match bitmap type */
  152.     cmInvalidSrcMap                = -4210,                        /* Source pix/bit map was invalid */
  153.     cmInvalidDstMap                = -4211,                        /* Destination pix/bit map was invalid */
  154.     cmNoGDevicesError            = -4212,                        /* Begin/End Matching -- no gdevices available */
  155.     cmInvalidProfileComment        = -4213,                        /* Bad Profile comment during drawpicture */
  156. /* Color Conversion Errors */
  157.     cmRangeOverFlow                = -4214,                        /* One or more output color value overflows in color conversion 
  158.                                                         all input color values will still be converted, and the overflown 
  159.                                                         will be clipped */
  160. /* Other Profile Access Errors */
  161.     cmCantCopyModifiedV1Profile    = -4215                            /* It is illegal to copy version 1 profiles that  
  162.                                                         have been modified */
  163. };
  164.  
  165. /* deviceType values for ColorSync 1.0 Device Profile access */
  166. enum {
  167.     cmSystemDevice                = 'sys ',
  168.     cmGDevice                    = 'gdev'
  169. };
  170.  
  171. /* Commands for CMFlattenUPP(…) */
  172. enum {
  173.     cmOpenReadSpool                = 1,
  174.     cmOpenWriteSpool,
  175.     cmReadSpool,
  176.     cmWriteSpool,
  177.     cmCloseSpool
  178. };
  179.  
  180. /* Flags for PostScript-related functions */
  181. enum {
  182.     cmPS7bit                    = 1,
  183.     cmPS8bit                    = 2
  184. };
  185.  
  186. typedef struct CMPrivateProfileRecord *CMProfileRef;
  187.  
  188. /* Abstract data type for Profile search result */
  189. typedef struct CMPrivateProfileSearchResult *CMProfileSearchRef;
  190.  
  191. /* Abstract data type for BeginMatching(…) reference */
  192. typedef struct CMPrivateMatchRefRecord *CMMatchRef;
  193.  
  194. /* Abstract data type for ColorWorld reference */
  195. typedef struct CMPrivateColorWorldRecord *CMWorldRef;
  196.  
  197. /* Caller-supplied progress function for Bitmap & PixMap matching routines */
  198. /* Caller-supplied filter function for Profile search */
  199. typedef pascal OSErr (*CMFlattenProcPtr)(long command, long *size, void *data, void *refCon);
  200. typedef pascal Boolean (*CMBitmapCallBackProcPtr)(long progress, void *refCon);
  201. typedef pascal Boolean (*CMProfileFilterProcPtr)(CMProfileRef prof, void *refCon);
  202.  
  203. #if GENERATINGCFM
  204. typedef UniversalProcPtr CMFlattenUPP;
  205. typedef UniversalProcPtr CMBitmapCallBackUPP;
  206. typedef UniversalProcPtr CMProfileFilterUPP;
  207. #else
  208. typedef CMFlattenProcPtr CMFlattenUPP;
  209. typedef CMBitmapCallBackProcPtr CMBitmapCallBackUPP;
  210. typedef CMProfileFilterProcPtr CMProfileFilterUPP;
  211. #endif
  212.  
  213. enum {
  214.     uppCMFlattenProcInfo = kPascalStackBased
  215.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  216.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  217.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long*)))
  218.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void*)))
  219.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))),
  220.     uppCMBitmapCallBackProcInfo = kPascalStackBased
  221.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  222.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  223.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*))),
  224.     uppCMProfileFilterProcInfo = kPascalStackBased
  225.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  226.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(CMProfileRef)))
  227.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  228. };
  229.  
  230. #if GENERATINGCFM
  231. #define NewCMFlattenProc(userRoutine)        \
  232.         (CMFlattenUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMFlattenProcInfo, GetCurrentArchitecture())
  233. #define NewCMBitmapCallBackProc(userRoutine)        \
  234.         (CMBitmapCallBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMBitmapCallBackProcInfo, GetCurrentArchitecture())
  235. #define NewCMProfileFilterProc(userRoutine)        \
  236.         (CMProfileFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMProfileFilterProcInfo, GetCurrentArchitecture())
  237. #else
  238. #define NewCMFlattenProc(userRoutine)        \
  239.         ((CMFlattenUPP) (userRoutine))
  240. #define NewCMBitmapCallBackProc(userRoutine)        \
  241.         ((CMBitmapCallBackUPP) (userRoutine))
  242. #define NewCMProfileFilterProc(userRoutine)        \
  243.         ((CMProfileFilterUPP) (userRoutine))
  244. #endif
  245.  
  246. #if GENERATINGCFM
  247. #define CallCMFlattenProc(userRoutine, command, size, data, refCon)        \
  248.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMFlattenProcInfo, (command), (size), (data), (refCon))
  249. #define CallCMBitmapCallBackProc(userRoutine, progress, refCon)        \
  250.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMBitmapCallBackProcInfo, (progress), (refCon))
  251. #define CallCMProfileFilterProc(userRoutine, prof, refCon)        \
  252.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMProfileFilterProcInfo, (prof), (refCon))
  253. #else
  254. #define CallCMFlattenProc(userRoutine, command, size, data, refCon)        \
  255.         (*(userRoutine))((command), (size), (data), (refCon))
  256. #define CallCMBitmapCallBackProc(userRoutine, progress, refCon)        \
  257.         (*(userRoutine))((progress), (refCon))
  258. #define CallCMProfileFilterProc(userRoutine, prof, refCon)        \
  259.         (*(userRoutine))((prof), (refCon))
  260. #endif
  261.  
  262. typedef long CMError;
  263.  
  264. /* For 1.0 and 2.0 profile header variants */
  265. /* CMAppleProfileHeader */
  266. union CMAppleProfileHeader {
  267.     CMHeader                        cm1;
  268.     CM2Header                        cm2;
  269. };
  270. typedef union CMAppleProfileHeader CMAppleProfileHeader;
  271.  
  272. /* Param for CWConcatColorWorld(…) */
  273. struct CMConcatProfileSet {
  274.     unsigned short                    keyIndex;                    /* Zero-based */
  275.     unsigned short                    count;                        /* Min 1 */
  276.     CMProfileRef                    profileSet[1];                /* Variable. Ordered from Source -> Dest */
  277. };
  278. typedef struct CMConcatProfileSet CMConcatProfileSet;
  279.  
  280. /* ColorSync color data types */
  281. struct CMRGBColor {
  282.     unsigned short                    red;                        /* 0..65535 */
  283.     unsigned short                    green;
  284.     unsigned short                    blue;
  285. };
  286. typedef struct CMRGBColor CMRGBColor;
  287.  
  288. struct CMCMYKColor {
  289.     unsigned short                    cyan;                        /* 0..65535 */
  290.     unsigned short                    magenta;
  291.     unsigned short                    yellow;
  292.     unsigned short                    black;
  293. };
  294. typedef struct CMCMYKColor CMCMYKColor;
  295.  
  296. struct CMCMYColor {
  297.     unsigned short                    cyan;                        /* 0..65535 */
  298.     unsigned short                    magenta;
  299.     unsigned short                    yellow;
  300. };
  301. typedef struct CMCMYColor CMCMYColor;
  302.  
  303. struct CMHLSColor {
  304.     unsigned short                    hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  305.     unsigned short                    lightness;                    /* 0..65535 */
  306.     unsigned short                    saturation;                    /* 0..65535 */
  307. };
  308. typedef struct CMHLSColor CMHLSColor;
  309.  
  310. struct CMHSVColor {
  311.     unsigned short                    hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  312.     unsigned short                    saturation;                    /* 0..65535 */
  313.     unsigned short                    value;                        /* 0..65535 */
  314. };
  315. typedef struct CMHSVColor CMHSVColor;
  316.  
  317. struct CMLabColor {
  318.     unsigned short                    L;                            /* 0..65535 maps to 0..100 */
  319.     unsigned short                    a;                            /* 0..65535 maps to -128..127.996 */
  320.     unsigned short                    b;                            /* 0..65535 maps to -128..127.996 */
  321. };
  322. typedef struct CMLabColor CMLabColor;
  323.  
  324. struct CMLuvColor {
  325.     unsigned short                    L;                            /* 0..65535 maps to 0..100 */
  326.     unsigned short                    u;                            /* 0..65535 maps to -128..127.996 */
  327.     unsigned short                    v;                            /* 0..65535 maps to -128..127.996 */
  328. };
  329. typedef struct CMLuvColor CMLuvColor;
  330.  
  331. struct CMYxyColor {
  332.     unsigned short                    capY;                        /* 0..65535 maps to 0..1 */
  333.     unsigned short                    x;                            /* 0..65535 maps to 0..1 */
  334.     unsigned short                    y;                            /* 0..65535 maps to 0..1 */
  335. };
  336. typedef struct CMYxyColor CMYxyColor;
  337.  
  338. struct CMGrayColor {
  339.     unsigned short                    gray;                        /* 0..65535 */
  340. };
  341. typedef struct CMGrayColor CMGrayColor;
  342.  
  343. struct CMMultichannel5Color {
  344.     unsigned char                    components[5];                /* 0..255 */
  345. };
  346. typedef struct CMMultichannel5Color CMMultichannel5Color;
  347.  
  348. struct CMMultichannel6Color {
  349.     unsigned char                    components[6];                /* 0..255 */
  350. };
  351. typedef struct CMMultichannel6Color CMMultichannel6Color;
  352.  
  353. struct CMMultichannel7Color {
  354.     unsigned char                    components[7];                /* 0..255 */
  355. };
  356. typedef struct CMMultichannel7Color CMMultichannel7Color;
  357.  
  358. struct CMMultichannel8Color {
  359.     unsigned char                    components[8];                /* 0..255 */
  360. };
  361. typedef struct CMMultichannel8Color CMMultichannel8Color;
  362.  
  363. union CMColor {
  364.     CMRGBColor                        rgb;
  365.     CMHSVColor                        hsv;
  366.     CMHLSColor                        hls;
  367.     CMXYZColor                        XYZ;
  368.     CMLabColor                        Lab;
  369.     CMLuvColor                        Luv;
  370.     CMYxyColor                        Yxy;
  371.     CMCMYKColor                        cmyk;
  372.     CMCMYColor                        cmy;
  373.     CMGrayColor                        gray;
  374.     CMMultichannel5Color            mc5;
  375.     CMMultichannel6Color            mc6;
  376.     CMMultichannel7Color            mc7;
  377.     CMMultichannel8Color            mc8;
  378. };
  379. typedef union CMColor CMColor;
  380.  
  381. struct CMProfileSearchRecord {
  382.     CMHeader                        header;
  383.     unsigned long                    fieldMask;
  384.     unsigned long                    reserved[2];
  385. };
  386. typedef struct CMProfileSearchRecord CMProfileSearchRecord, **CMProfileSearchRecordHandle;
  387.  
  388. /* Search definition for 2.0 */
  389. struct CMSearchRecord {
  390.     OSType                            CMMType;
  391.     OSType                            profileClass;
  392.     OSType                            dataColorSpace;
  393.     OSType                            profileConnectionSpace;
  394.     unsigned long                    deviceManufacturer;
  395.     unsigned long                    deviceModel;
  396.     unsigned long                    deviceAttributes[2];
  397.     unsigned long                    profileFlags;
  398.     unsigned long                    searchMask;
  399.     CMProfileFilterUPP                filter;
  400. };
  401. typedef struct CMSearchRecord CMSearchRecord;
  402.  
  403. /* GetCWInfo structures */
  404. struct CMMInfoRecord {
  405.     OSType                            CMMType;
  406.     long                            CMMVersion;
  407. };
  408. typedef struct CMMInfoRecord CMMInfoRecord;
  409.  
  410. struct CMCWInfoRecord {
  411.     unsigned long                    cmmCount;
  412.     CMMInfoRecord                    cmmInfo[2];
  413. };
  414. typedef struct CMCWInfoRecord CMCWInfoRecord;
  415.  
  416.  
  417. enum {
  418.     cmNoColorPacking            = 0x0000,
  419.     cmAlphaSpace                = 0x0080,
  420.     cmWord5ColorPacking            = 0x0500,
  421.     cmLong8ColorPacking            = 0x0800,
  422.     cmLong10ColorPacking        = 0x0a00,
  423.     cmAlphaFirstPacking            = 0x1000,
  424.     cmOneBitDirectPacking        = 0x0b00
  425. };
  426.  
  427. enum {
  428.     cmNoSpace                    = 0,
  429.     cmRGBSpace,
  430.     cmCMYKSpace,
  431.     cmHSVSpace,
  432.     cmHLSSpace,
  433.     cmYXYSpace,
  434.     cmXYZSpace,
  435.     cmLUVSpace,
  436.     cmLABSpace,
  437.     cmReservedSpace1,
  438.     cmGraySpace,
  439.     cmReservedSpace2,
  440.     cmGamutResultSpace,
  441.     cmRGBASpace                    = cmRGBSpace + cmAlphaSpace,
  442.     cmGrayASpace                = cmGraySpace + cmAlphaSpace,
  443.     cmRGB16Space                = cmWord5ColorPacking + cmRGBSpace,
  444.     cmRGB32Space                = cmLong8ColorPacking + cmRGBSpace,
  445.     cmARGB32Space                = cmLong8ColorPacking + cmAlphaFirstPacking + cmRGBASpace,
  446.     cmCMYK32Space                = cmLong8ColorPacking + cmCMYKSpace,
  447.     cmHSV32Space                = cmLong10ColorPacking + cmHSVSpace,
  448.     cmHLS32Space                = cmLong10ColorPacking + cmHLSSpace,
  449.     cmYXY32Space                = cmLong10ColorPacking + cmYXYSpace,
  450.     cmXYZ32Space                = cmLong10ColorPacking + cmXYZSpace,
  451.     cmLUV32Space                = cmLong10ColorPacking + cmLUVSpace,
  452.     cmLAB32Space                = cmLong10ColorPacking + cmLABSpace,
  453.     cmGamutResult1Space            = cmOneBitDirectPacking + cmGamutResultSpace
  454. };
  455.  
  456. typedef unsigned long CMBitmapColorSpace;
  457.  
  458. struct CMBitmap {
  459.     char                            *image;
  460.     long                            width;
  461.     long                            height;
  462.     long                            rowBytes;
  463.     long                            pixelSize;
  464.     CMBitmapColorSpace                space;
  465.     long                            user1;
  466.     long                            user2;
  467. };
  468. typedef struct CMBitmap CMBitmap;
  469.  
  470. /* Classic Print Manager Stuff */
  471.  
  472. enum {
  473.     enableColorMatchingOp        = 12,
  474.     registerProfileOp            = 13
  475. };
  476.  
  477. /* PrGeneral parameter blocks */
  478. struct TEnableColorMatchingBlk {
  479.     short                            iOpCode;
  480.     short                            iError;
  481.     long                            lReserved;
  482.     THPrint                            hPrint;
  483.     Boolean                            fEnableIt;
  484.     SInt8                            filler;
  485. };
  486. typedef struct TEnableColorMatchingBlk TEnableColorMatchingBlk;
  487.  
  488. struct TRegisterProfileBlk {
  489.     short                            iOpCode;
  490.     short                            iError;
  491.     long                            lReserved;
  492.     THPrint                            hPrint;
  493.     Boolean                            fRegisterIt;
  494.     SInt8                            filler;
  495. };
  496. typedef struct TRegisterProfileBlk TRegisterProfileBlk;
  497.  
  498.  
  499. enum {
  500.     cmNoProfileBase                = 0,
  501.     cmFileBasedProfile            = 1,
  502.     cmHandleBasedProfile        = 2,
  503.     cmPtrBasedProfile            = 3
  504. };
  505.  
  506. struct CMFileLocation {
  507.     FSSpec                            spec;
  508. };
  509. typedef struct CMFileLocation CMFileLocation;
  510.  
  511. struct CMHandleLocation {
  512.     Handle                            h;
  513. };
  514. typedef struct CMHandleLocation CMHandleLocation;
  515.  
  516. struct CMPtrLocation {
  517.     Ptr                                p;
  518. };
  519. typedef struct CMPtrLocation CMPtrLocation;
  520.  
  521. union CMProfLoc {
  522.     CMFileLocation                    fileLoc;
  523.     CMHandleLocation                handleLoc;
  524.     CMPtrLocation                    ptrLoc;
  525. };
  526. typedef union CMProfLoc CMProfLoc;
  527.  
  528. struct CMProfileLocation {
  529.     short                            locType;
  530.     CMProfLoc                        u;
  531. };
  532. typedef struct CMProfileLocation CMProfileLocation;
  533.  
  534. /* Profile file and element access */
  535. extern pascal CMError CMOpenProfile(CMProfileRef *prof, const CMProfileLocation *theProfile)
  536.  FOURWORDINLINE(0x203C, 0x0008, 0x001C, 0xABEE);
  537. extern pascal CMError CMCloseProfile(CMProfileRef prof)
  538.  FOURWORDINLINE(0x203C, 0x0004, 0x001D, 0xABEE);
  539. extern pascal CMError CMUpdateProfile(CMProfileRef prof)
  540.  FOURWORDINLINE(0x203C, 0x0004, 0x0034, 0xABEE);
  541. extern pascal CMError CMNewProfile(CMProfileRef *prof, const CMProfileLocation *theProfile)
  542.  FOURWORDINLINE(0x203C, 0x0008, 0x001B, 0xABEE);
  543. extern pascal CMError CMCopyProfile(CMProfileRef *targetProf, const CMProfileLocation *targetLocation, CMProfileRef srcProf)
  544.  FOURWORDINLINE(0x203C, 0x000C, 0x0025, 0x0ABEE);
  545. extern pascal CMError CMGetProfileLocation(CMProfileRef prof, CMProfileLocation *theProfile)
  546.  FOURWORDINLINE(0x203C, 0x0008, 0x003C, 0x0ABEE);
  547. extern pascal CMError CMValidateProfile(CMProfileRef prof, Boolean *valid, Boolean *preferredCMMnotfound)
  548.  FOURWORDINLINE(0x203C, 0x000C, 0x0026, 0x0ABEE);
  549. extern pascal CMError CMFlattenProfile(CMProfileRef prof, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  550.  FOURWORDINLINE(0x203C, 0x0014, 0x0031, 0x0ABEE);
  551. extern pascal CMError CMUnflattenProfile(FSSpec *resultFileSpec, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  552.  FOURWORDINLINE(0x203C, 0x0010, 0x0032, 0x0ABEE);
  553. extern pascal CMError CMProfileElementExists(CMProfileRef prof, OSType tag, Boolean *found)
  554.  FOURWORDINLINE(0x203C, 0x000C, 0x001E, 0x0ABEE);
  555. extern pascal CMError CMCountProfileElements(CMProfileRef prof, unsigned long *elementCount)
  556.  FOURWORDINLINE(0x203C, 0x0008, 0x001F, 0x0ABEE);
  557. extern pascal CMError CMGetProfileElement(CMProfileRef prof, OSType tag, unsigned long *elementSize, void *elementData)
  558.  FOURWORDINLINE(0x203C, 0x0010, 0x0020, 0x0ABEE);
  559. extern pascal CMError CMGetProfileHeader(CMProfileRef prof, CMAppleProfileHeader *header)
  560.  FOURWORDINLINE(0x203C, 0x0008, 0x0039, 0x0ABEE);
  561. extern pascal CMError CMGetPartialProfileElement(CMProfileRef prof, OSType tag, unsigned long offset, unsigned long *byteCount, void *elementData)
  562.  FOURWORDINLINE(0x203C, 0x0014, 0x0036, 0x0ABEE);
  563. extern pascal CMError CMSetProfileElementSize(CMProfileRef prof, OSType tag, unsigned long elementSize)
  564.  FOURWORDINLINE(0x203C, 0x000C, 0x0038, 0x0ABEE);
  565. extern pascal CMError CMSetPartialProfileElement(CMProfileRef prof, OSType tag, unsigned long offset, unsigned long byteCount, void *elementData)
  566.  FOURWORDINLINE(0x203C, 0x0014, 0x0037, 0x0ABEE);
  567. extern pascal CMError CMGetIndProfileElementInfo(CMProfileRef prof, unsigned long index, OSType *tag, unsigned long *elementSize, Boolean *refs)
  568.  FOURWORDINLINE(0x203C, 0x0014, 0x0021, 0x0ABEE);
  569. extern pascal CMError CMGetIndProfileElement(CMProfileRef prof, unsigned long index, unsigned long *elementSize, void *elementData)
  570.  FOURWORDINLINE(0x203C, 0x0010, 0x0022, 0x0ABEE);
  571. extern pascal CMError CMSetProfileElement(CMProfileRef prof, OSType tag, unsigned long elementSize, void *elementData)
  572.  FOURWORDINLINE(0x203C, 0x0010, 0x0023, 0x0ABEE);
  573. extern pascal CMError CMSetProfileHeader(CMProfileRef prof, const CMAppleProfileHeader *header)
  574.  FOURWORDINLINE(0x203C, 0x0008, 0x003A, 0x0ABEE);
  575. extern pascal CMError CMSetProfileElementReference(CMProfileRef prof, OSType elementTag, OSType referenceTag)
  576.  FOURWORDINLINE(0x203C, 0x000C, 0x0035, 0x0ABEE);
  577. extern pascal CMError CMRemoveProfileElement(CMProfileRef prof, OSType tag)
  578.  FOURWORDINLINE(0x203C, 0x0008, 0x0024, 0x0ABEE);
  579. extern pascal CMError CMGetScriptProfileDescription(CMProfileRef prof, Str255 name, ScriptCode *code)
  580.  FOURWORDINLINE(0x203C, 0x000C, 0x003E, 0x0ABEE);
  581. /* Low-level matching functions */
  582. extern pascal CMError NCWNewColorWorld(CMWorldRef *cw, CMProfileRef src, CMProfileRef dst)
  583.  FOURWORDINLINE(0x203C, 0x000C, 0x0014, 0x0ABEE);
  584. extern pascal CMError CWConcatColorWorld(CMWorldRef *cw, CMConcatProfileSet *profileSet)
  585.  FOURWORDINLINE(0x203C, 0x0008, 0x0015, 0x0ABEE);
  586. extern pascal CMError CWNewLinkProfile(CMProfileRef *prof, const CMProfileLocation *targetLocation, CMConcatProfileSet *profileSet)
  587.  FOURWORDINLINE(0x203C, 0x000C, 0x0033, 0x0ABEE);
  588. extern pascal void CWDisposeColorWorld(CMWorldRef cw)
  589.  FOURWORDINLINE(0x203C, 0x0004, 0x0001, 0x0ABEE);
  590. extern pascal CMError CWMatchColors(CMWorldRef cw, CMColor *myColors, unsigned long count)
  591.  FOURWORDINLINE(0x203C, 0x000C, 0x0002, 0x0ABEE);
  592. extern pascal CMError CWCheckColors(CMWorldRef cw, CMColor *myColors, unsigned long count, long *result)
  593.  FOURWORDINLINE(0x203C, 0x0010, 0x0003, 0x0ABEE);
  594. /* Bitmap matching */
  595. extern pascal CMError CWMatchBitmap(CMWorldRef cw, CMBitmap *bitmap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitmap *matchedBitmap)
  596.  FOURWORDINLINE(0x203C, 0x0010, 0x002C, 0x0ABEE);
  597. extern pascal CMError CWCheckBitmap(CMWorldRef cw, const CMBitmap *bitmap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitmap *resultBitmap)
  598.  FOURWORDINLINE(0x203C, 0x0014, 0x002D, 0x0ABEE);
  599. /* Quickdraw-specific matching */
  600. extern pascal CMError CWMatchPixMap(CMWorldRef cw, PixMap *myPixMap, CMBitmapCallBackUPP progressProc, void *refCon)
  601.  FOURWORDINLINE(0x203C, 0x0010, 0x0004, 0x0ABEE);
  602. extern pascal CMError CWCheckPixMap(CMWorldRef cw, PixMap *myPixMap, CMBitmapCallBackUPP progressProc, void *refCon, BitMap *resultBitMap)
  603.  FOURWORDINLINE(0x203C, 0x0014, 0x0007, 0x0ABEE);
  604. extern pascal CMError NCMBeginMatching(CMProfileRef src, CMProfileRef dst, CMMatchRef *myRef)
  605.  FOURWORDINLINE(0x203C, 0x000C, 0x0016, 0x0ABEE);
  606. extern pascal void CMEndMatching(CMMatchRef myRef)
  607.  FOURWORDINLINE(0x203C, 0x0004, 0x000B, 0x0ABEE);
  608. extern pascal void NCMDrawMatchedPicture(PicHandle myPicture, CMProfileRef dst, Rect *myRect)
  609.  FOURWORDINLINE(0x203C, 0x000C, 0x0017, 0x0ABEE);
  610. extern pascal void CMEnableMatchingComment(Boolean enableIt)
  611.  FOURWORDINLINE(0x203C, 0x0002, 0x000D, 0x0ABEE);
  612. extern pascal CMError NCMUseProfileComment(CMProfileRef prof, unsigned long flags)
  613.  FOURWORDINLINE(0x203C, 0x0008, 0x003B, 0x0ABEE);
  614. /* System Profile access */
  615. extern pascal CMError CMGetSystemProfile(CMProfileRef *prof)
  616.  FOURWORDINLINE(0x203C, 0x0004, 0x0018, 0x0ABEE);
  617. extern pascal CMError CMSetSystemProfile(const FSSpec *profileFileSpec)
  618.  FOURWORDINLINE(0x203C, 0x0004, 0x0019, 0x0ABEE);
  619. /* External Profile Management */
  620. extern pascal CMError CMNewProfileSearch(CMSearchRecord *searchSpec, void *refCon, unsigned long *count, CMProfileSearchRef *searchResult)
  621.  FOURWORDINLINE(0x203C, 0x0010, 0x0027, 0x0ABEE);
  622. extern pascal CMError CMUpdateProfileSearch(CMProfileSearchRef search, void *refCon, unsigned long *count)
  623.  FOURWORDINLINE(0x203C, 0x000C, 0x0028, 0x0ABEE);
  624. extern pascal void CMDisposeProfileSearch(CMProfileSearchRef search)
  625.  FOURWORDINLINE(0x203C, 0x0004, 0x0029, 0x0ABEE);
  626. extern pascal CMError CMSearchGetIndProfile(CMProfileSearchRef search, unsigned long index, CMProfileRef *prof)
  627.  FOURWORDINLINE(0x203C, 0x000C, 0x002A, 0x0ABEE);
  628. extern pascal CMError CMSearchGetIndProfileFileSpec(CMProfileSearchRef search, unsigned long index, FSSpec *profileFile)
  629.  FOURWORDINLINE(0x203C, 0x000C, 0x002B, 0x0ABEE);
  630. /* Utilities */
  631. extern pascal CMError CMGetColorSyncFolderSpec(short vRefNum, Boolean createFolder, short *foundVRefNum, long *foundDirID)
  632.  FOURWORDINLINE(0x203C, 0x000C, 0x0011, 0x0ABEE);
  633. extern pascal CMError CMGetCWInfo(CMWorldRef cw, CMCWInfoRecord *info)
  634.  FOURWORDINLINE(0x203C, 0x000C, 0x001A, 0x0ABEE);
  635. /* PS-related */
  636. extern pascal CMError CMGetPS2ColorSpace(CMProfileRef srcProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  637.  FOURWORDINLINE(0x203C, 0x0014, 0x002E, 0x0ABEE);
  638. extern pascal CMError CMGetPS2ColorRenderingIntent(CMProfileRef srcProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  639.  FOURWORDINLINE(0x203C, 0x0014, 0x002F, 0x0ABEE);
  640. extern pascal CMError CMGetPS2ColorRendering(CMProfileRef srcProf, CMProfileRef dstProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  641.  FOURWORDINLINE(0x203C, 0x0018, 0x0030, 0x0ABEE);
  642. extern pascal CMError CMGetPS2ColorRenderingVMSize(CMProfileRef srcProf, CMProfileRef dstProf, unsigned long *vmSize, Boolean *preferredCMMnotfound)
  643.  FOURWORDINLINE(0x203C, 0x0010, 0x003D, 0x0ABEE);
  644. /* ColorSync 1.0 functions which have parallel 2.0 counterparts */
  645. extern pascal CMError CWNewColorWorld(CMWorldRef *cw, CMProfileHandle src, CMProfileHandle dst)
  646.  FOURWORDINLINE(0x203C, 0x000C, 0x0000, 0x0ABEE);
  647. extern pascal CMError ConcatenateProfiles(CMProfileHandle thru, CMProfileHandle dst, CMProfileHandle *newDst)
  648.  FOURWORDINLINE(0x203C, 0x000C, 0x000C, 0x0ABEE);
  649. extern pascal CMError CMBeginMatching(CMProfileHandle src, CMProfileHandle dst, CMMatchRef *myRef)
  650.  FOURWORDINLINE(0x203C, 0x000C, 0x000A, 0x0ABEE);
  651. extern pascal void CMDrawMatchedPicture(PicHandle myPicture, CMProfileHandle dst, Rect *myRect)
  652.  FOURWORDINLINE(0x203C, 0x000C, 0x0009, 0x0ABEE);
  653. extern pascal CMError CMUseProfileComment(CMProfileHandle profile)
  654.  FOURWORDINLINE(0x203C, 0x0004, 0x0008, 0x0ABEE);
  655. extern pascal void CMGetProfileName(CMProfileHandle myProfile, CMIString *IStringResult)
  656.  FOURWORDINLINE(0x203C, 0x0008, 0x000E, 0x0ABEE);
  657. extern pascal long CMGetProfileAdditionalDataOffset(CMProfileHandle myProfile)
  658.  FOURWORDINLINE(0x203C, 0x0004, 0x000F, 0x0ABEE);
  659. /* ProfileResponder functions */
  660. extern pascal CMError GetProfile(OSType deviceType, long refNum, CMProfileHandle aProfile, CMProfileHandle *returnedProfile)
  661.  FOURWORDINLINE(0x203C, 0x0010, 0x0005, 0x0ABEE);
  662. extern pascal CMError SetProfile(OSType deviceType, long refNum, CMProfileHandle newProfile)
  663.  FOURWORDINLINE(0x203C, 0x000C, 0x0006, 0x0ABEE);
  664. extern pascal CMError SetProfileDescription(OSType deviceType, long refNum, long deviceData, CMProfileHandle hProfile)
  665.  FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0x0ABEE);
  666. extern pascal CMError GetIndexedProfile(OSType deviceType, long refNum, CMProfileSearchRecordHandle search, CMProfileHandle *returnProfile, long *index)
  667.  FOURWORDINLINE(0x203C, 0x0014, 0x0012, 0x0ABEE);
  668. extern pascal CMError DeleteDeviceProfile(OSType deviceType, long refNum, CMProfileHandle deleteMe)
  669.  FOURWORDINLINE(0x203C, 0x000C, 0x0013, 0x0ABEE);
  670. #if OLDROUTINENAMES
  671. typedef CMFlattenProcPtr CMFlattenProc;
  672.  
  673. typedef CMBitmapCallBackProcPtr CMBitmapCallBackProc;
  674.  
  675. typedef CMProfileFilterProcPtr CMProfileFilterProc;
  676.  
  677.  
  678. enum {
  679.     CMTrap                        = cmTrap,
  680.     CMBeginProfile                = cmBeginProfile,
  681.     CMEndProfile                = cmEndProfile,
  682.     CMEnableMatching            = cmEnableMatching,
  683.     CMDisableMatching            = cmDisableMatching
  684. };
  685.  
  686. /* 1.0 Error codes, for compatibility with older applications. 1.0 CMM's may return obsolete error codes */
  687. enum {
  688.     CMNoError                    = 0,                            /*    obsolete name, use noErr */
  689.     CMProfileError                = cmProfileError,
  690.     CMMethodError                = cmMethodError,
  691.     CMMemFullError                = -172,                            /*    obsolete, 2.0 uses memFullErr */
  692.     CMUnimplementedError        = -173,                            /*    obsolete, 2.0 uses unimpErr */
  693.     CMParamError                = -174,                            /*    obsolete, 2.0 uses paramErr */
  694.     CMMethodNotFound            = cmMethodNotFound,
  695.     CMProfileNotFound            = cmProfileNotFound,
  696.     CMProfilesIdentical            = cmProfilesIdentical,
  697.     CMCantConcatenateError        = cmCantConcatenateError,
  698.     CMCantXYZ                    = cmCantXYZ,
  699.     CMCantDeleteProfile            = cmCantDeleteProfile,
  700.     CMUnsupportedDataType        = cmUnsupportedDataType,
  701.     CMNoCurrentProfile            = cmNoCurrentProfile
  702. };
  703.  
  704. enum {
  705.     qdSystemDevice                = cmSystemDevice,
  706.     qdGDevice                    = cmGDevice
  707. };
  708.  
  709. enum {
  710.     kMatchCMMType                = cmMatchCMMType,
  711.     kMatchApplProfileVersion    = cmMatchApplProfileVersion,
  712.     kMatchDataType                = cmMatchDataType,
  713.     kMatchDeviceType            = cmMatchDeviceType,
  714.     kMatchDeviceManufacturer    = cmMatchDeviceManufacturer,
  715.     kMatchDeviceModel            = cmMatchDeviceModel,
  716.     kMatchDeviceAttributes        = cmMatchDeviceAttributes,
  717.     kMatchFlags                    = cmMatchFlags,
  718.     kMatchOptions                = cmMatchOptions,
  719.     kMatchWhite                    = cmMatchWhite,
  720.     kMatchBlack                    = cmMatchBlack
  721. };
  722.  
  723. /* types */
  724. typedef struct CMCMYKColor CMYKColor;
  725.  
  726. typedef CMWorldRef CWorld;
  727.  
  728. typedef long *CMGamutResult;
  729.  
  730. /* functions */
  731. #define EndMatching(myRef) CMEndMatching(myRef)
  732. #define EnableMatching(enableIt) CMEnableMatchingComment(enableIt)
  733. #define GetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID) CMGetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID)
  734. #define BeginMatching(src, dst, myRef) CMBeginMatching(src, dst, myRef)
  735. #define DrawMatchedPicture(myPicture, dst, myRect) CMDrawMatchedPicture(myPicture, dst, myRect)
  736. #define UseProfile(profile) CMUseProfileComment(profile)
  737. #define GetProfileName(myProfile, IStringResult) CMGetProfileName(myProfile, IStringResult)
  738. #define GetProfileAdditionalDataOffset(myProfile) CMGetProfileAdditionalDataOffset(myProfile)
  739. #endif
  740.  
  741. #if PRAGMA_IMPORT_SUPPORTED
  742. #pragma import off
  743. #endif
  744.  
  745. #if PRAGMA_ALIGN_SUPPORTED
  746. #pragma options align=reset
  747. #endif
  748.  
  749. #ifdef __cplusplus
  750. }
  751. #endif
  752.  
  753. #endif /* __CMAPPLICATION__ */
  754.